<!DOCTYPE html>
<html>
<head>
    <title></title>
    <#include "../header.html" encoding="UTF-8"/>
    <style>
        .upload-list{
            display: inline-block;
            width: 60px;
            height: 60px;
            text-align: center;
            line-height: 60px;
            border: 1px solid transparent;
            border-radius: 4px;
            overflow: hidden;
            background: #fff;
            position: relative;
            box-shadow: 0 1px 1px rgba(0,0,0,.2);
            margin-right: 4px;
        }
        .upload-list img{
            width: 100%;
            height: 100%;
        }
        .upload-list-cover{
            display: none;
            position: absolute;
            top: 0;
            bottom: 0;
            left: 0;
            right: 0;
            background: rgba(0,0,0,.6);
        }
        .upload-list:hover .upload-list-cover{
            display: block;
        }
        .upload-list-cover i{
            color: #fff;
            font-size: 20px;
            cursor: pointer;
            margin: 0 2px;
        }
    </style>
</head>
<body>
<div id="rrapp" v-cloak>
    <div v-show="showList">
        <Row :gutter="16">
                <i-col span="4">

                        <i-input type="text" v-model="q.name" @on-enter="query" placeholder="名称"/>

                </i-col>
                <!--<i-col span="8">-->
                   <!-- <Form-item prop="categoryId">
                        <i-input v-model="q.categoryId" @on-click="categoryTree" icon="eye" readonly="readonly"
                                 placeholder="商品类型"/>
                    </Form-item>-->
              <!--  </i-col>-->
                    <i-button @click="query" >查询</i-button>
                    <i-button @click="handleReset('formValidate1')" >重置</i-button>



            <!--<i-button @click="query" >查询</i-button>
            <i-button @click="handleReset('formValidate')" >重置</i-button>-->
           <!-- #if($shiro.hasPermission("books:save"))-->
            <i-button type="info" @click="add"><i class="fa fa-plus"></i>&nbsp;新增</i-button>
           <!-- #end
            #if($shiro.hasPermission("books:update"))-->
            <i-button type="warning" @click="update"><i class="fa fa-pencil-square-o"></i>&nbsp;修改</i-button>
           <!-- #end
            #if($shiro.hasPermission("books:delete"))-->
            <i-button type="error" @click="del"><i class="fa fa-trash-o"></i>&nbsp;删除</i-button>
           <!-- #end-->
            <i-button type="primary" @click="enSale"><i class="fa fa-hand-o-up"></i>&nbsp;上架</i-button>
            <i-button type="dashed" @click="unSale"><i class="fa fa-hand-o-down"></i>&nbsp;下架</i-button>
           <!-- <i-button type="warning" @click="openPro"><i class="fa fa-pencil-square-o"></i>&nbsp;产品</i-button>
            <i-button type="warning" @click="openSpe"><i class="fa fa-pencil-square-o"></i>&nbsp;规格</i-button>-->
        </Row>
        <table id="jqGrid"></table>
        <div id="jqGridPager"></div>
    </div>

    <Card v-show="!showList">
        <p slot="title">{{title}}</p>
        <Tabs value="name1">
            <Tab-Pane label="通用信息" name="name1">
                <i-form ref="formValidate" :model="books" :rules="ruleValidate" :label-width="80">

                    <Form-item label="名称" prop="name">
                        <i-input v-model="books.name" placeholder="名称"/>
                    </Form-item>

                    <Form-item label="商品类型" prop="category.name">
                        <i-input v-model="books.category.name" @on-click="categoryTree" icon="eye" readonly="readonly"
                                 placeholder="商品类型"/>
                    </Form-item>

                    <Form-item label="上新时间" prop="createTime">
                        <Date-picker v-model="books.createTime" placeholder="上新时间"
                                      style="width: 188px;"/>
                    </Form-item>
                    <Form-item label="零售价格" prop="unitPrice">
                        <Input-number :min="0" :step="1" v-model="books.unitPrice" placeholder="零售价格"
                                      style="width: 188px;"/>
                    </Form-item>
                    <Form-item label="作者" prop="author">
                        <i-input  v-model="books.author" placeholder="作者"
                                      style="width: 188px;"/>
                    </Form-item>
                    <Form-item label="出版社" prop="publisher">
                        <i-input  v-model="books.publisher" placeholder="出版社"
                                      style="width: 188px;"/>
                    </Form-item>
                    <Form-item label="ISBN" prop="isbn">
                        <i-input  v-model="books.isbn" placeholder="ISBN"
                                      style="width: 188px;"/>
                    </Form-item>
                    <Row><!--商品列表图-->
                        <i-col span="16">
                            <Form-item label="商品列表图" prop="listPicUrl">
                                <i-input v-model="books.listPicUrl" placeholder="商品列表图" readonly/>
                            </Form-item>
                        </i-col>
                        <i-col span="3">
                            <Form-item :label-width="1">
                                <Upload style="width: 300px;" action="../file/upload" :format="['jpg','jpeg','png']"
                                        max-size="2048"
                                        :on-success="handleSuccessListPicUrl" :on-format-error="handleFormatError"
                                        :show-upload-list="false"
                                        :on-exceeded-size="handleMaxSize">
                                    <i-button icon="ios-cloud-upload-outline">上传图片</i-button>
                                </Upload>
                            </Form-item>
                        </i-col>
                        <i-col span="3">
                            <Form-item :label-width="1">
                                <i-button icon="eye" @click="eyeImageListPicUrl">预览图片</i-button>
                            </Form-item>
                        </i-col>
                    </Row>
                </i-form>
            </Tab-Pane>

            <Tab-Pane label="详细描述" name="name2">
                <div id="bookDesc"></div>
            </Tab-Pane>
            <Tab-Pane label="其他信息" name="name3">
                <i-form ref="formValidate" :model="books" :rules="ruleValidate" :label-width="80">
                    <Form-item label="商品库存" prop="storage">
                        <Input-number :min="0" :step="1" v-model="books.storage" placeholder="商品库存"
                                      style="width: 188px;"/>
                    </Form-item>
                    <Form-item label="借阅量" prop="broNum">
                        <Input-number :min="0" :step="1" v-model="books.broNum" placeholder="借阅量"
                                      style="width: 188px;"/>
                    </Form-item>
                    <Form-item label="限制购买量" prop="isLimited">
                        <Input-number :min="0" :step="1" v-model="books.isLimited" placeholder="限制购买量"
                                      style="width: 188px;"/>
                    </Form-item>
                    <Form-item label="排序" prop="sortOrder">
                        <Input-number :min="0" :step="1" v-model="books.sortOrder" placeholder="排序"
                                      style="width: 188px;"/>
                    </Form-item>
                    <Form-item label="上架" prop="isOnSale">
                        <Radio-group v-model="books.isOnSale">
                            <Radio label="1">
                                <span>是</span>
                            </Radio>
                            <Radio label="0">
                                <span>否</span>
                            </Radio>
                        </Radio-group>
                    </Form-item>
                    <Form-item label="是否新商品" prop="isNew">
                        <Radio-group v-model="books.isNew">
                            <Radio label="1">
                                <span>是</span>
                            </Radio>
                            <Radio label="0">
                                <span>否</span>
                            </Radio>
                        </Radio-group>
                    </Form-item>
                    <Form-item label="热销" prop="isHot">
                        <Radio-group v-model="books.isHot">
                            <Radio label="1">
                                <span>是</span>
                            </Radio>
                            <Radio label="0">
                                <span>否</span>
                            </Radio>
                        </Radio-group>
                    </Form-item>
                    <Form-item label="简明介绍" prop="description">
                        <i-input v-model="books.description" placeholder="简明介绍"/>
                    </Form-item>
                </i-form>
            </Tab-Pane>
        </Tabs>
        <div style="padding-left: 20px">
            <i-button type="primary" @click="handleSubmit('formValidate')">提交</i-button>
            <i-button type="warning" @click="reload" style="margin-left: 8px"/>
            返回</i-button>
            <i-button type="ghost" @click="handleReset('formValidate')" style="margin-left: 8px">重置</i-button>
        </div>
    </Card>
</div>

<!-- 选择类型 -->
<div id="categoryLayer" style="display: none;padding:10px;">
    <ul id="categoryTree" class="ztree"></ul>
</div>

<script src="${rc.contextPath}/static/vue/js/shop/book.js"></script>
</body>
</html>